import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:shouyin_app/common/base/base.dart';
import 'package:shouyin_app/common/service/config_service.dart';
import 'package:shouyin_app/common/utils/utils.dart';

///全局初始化
class Global{
  static final Global _instance = Global._internal();

  factory Global() => _instance;

  Global._internal();

  static Future<void> init() async {
    // 运行初始
    WidgetsFlutterBinding.ensureInitialized();
    // 屏幕方向  竖屏
    await SystemChrome.setPreferredOrientations([
      DeviceOrientation.landscapeLeft,
      DeviceOrientation.landscapeRight]);

    await SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.bottom]);
    await StorageUtil().init();
    await Future.wait([
        Get.put<ConfigService>(ConfigService()).init()
    ]).whenComplete(() {

    });
  }
}